﻿@Html.DevExpress().GridView(
            settings =>
            {
                settings.Name = "gvEditing";
                settings.KeyFieldName = "xh";
                settings.CallbackRouteValues = new { Controller = "AllowanceIssueManage", Action = "AllowanceIssueListPartial" };
                settings.Width =System.Web.UI.WebControls.Unit.Percentage(100);

                settings.Columns.Add("xh", "序号");
                settings.Columns.Add("FAdjustAmount", "调整金额(万元)");
                settings.Columns.Add("FSpecialAdjustName", "调整类型");
                settings.Columns.Add("FNote", "备注").CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
                settings.Columns.Add("FInsDate", "调整日期");
                settings.Columns.Add("FEmpName", "调整人员");
                
                settings.SettingsBehavior.AllowSort = false;
                settings.SettingsBehavior.AllowDragDrop = false;
                settings.SettingsBehavior.AllowSelectByRowClick = false;
                settings.SettingsLoadingPanel.Text = "数据读取中...";
                settings.SettingsBehavior.AllowClientEventsOnLoad = false;
                settings.SettingsBehavior.AllowFocusedRow = true;
                settings.SettingsPager.PageSize = 20;
               
                settings.ClientSideEvents.BeginCallback = "function(s,e){OnBeginCallback(s,e)}";
                settings.CommandColumn.Visible = false;

                settings.PageIndexChanged = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    grid.Selection.UnselectAll();
                };
                settings.DataBinding = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    for (int i = 0; i < grid.AllColumns.Count; i++)
                    {
                        if (grid.AllColumns[i].CellStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                        if (grid.AllColumns[i].HeaderStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                    }
                };                                       
                
            }).Bind(Model).GetHtml()
